/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dio.com.gui;

import dio.com.controller.EmpresaController;
import dio.com.model.Facade;
import dio.com.model.bean.*;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;

/**
 *
 * @author Diógenes
 */
public class TelaPrincipal extends javax.swing.JFrame {

    static String mac = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    EmpresaController EC = new EmpresaController();
    private Periodo periodo;
    private Imposto imposto;
    private Movimento movimento;
    private Empresa empresa;
    private List<Empresa> empresas;
    private Usuario usuario;
    private AnalisePendencias ap;

    /**
     * Creates new form TelaPrincipal
     */
    public TelaPrincipal(Usuario u) {
        periodo = new Periodo();
        imposto = new Imposto();
        movimento = new Movimento();
        empresa = new Empresa();
        usuario = u;
        initComponents();
        setExtendedState(MAXIMIZED_BOTH);
        setTitle(getTitle() + " - Colaborador: " + u.getNome());
        carregarComboEmpresas();
        carregarData();
        if (empresas != null) {
            carregarMovimentos();
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem1 = new javax.swing.JMenuItem();
        cbEmpresas = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        cbMes = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        cbAno = new javax.swing.JComboBox();
        jLabel40 = new javax.swing.JLabel();
        jTextField38 = new javax.swing.JTextField();
        jLabel41 = new javax.swing.JLabel();
        tfCodigo = new javax.swing.JTextField();
        jLabel42 = new javax.swing.JLabel();
        tfNumContrato = new javax.swing.JTextField();
        jLabel43 = new javax.swing.JLabel();
        tfPin = new javax.swing.JTextField();
        jLabel44 = new javax.swing.JLabel();
        tfPuk = new javax.swing.JTextField();
        jButton6 = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        tfEscrituracao = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        tfIntegracaoContabil = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        tfDarfIrrf = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        tfDaeParcelado = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        tfISS = new javax.swing.JTextField();
        tfIPI = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        tjPIS = new javax.swing.JTextField();
        tjCofins = new javax.swing.JTextField();
        tjICMSNormal = new javax.swing.JTextField();
        tjICMSAntecipado = new javax.swing.JTextField();
        tjIRPJ = new javax.swing.JTextField();
        tjCSLL = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        tjSimplesNacional = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        tfContabilizadoAte = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        tfDataDaUltimaMovimentacao = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        tfGPS = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        tfFolhaPagamento = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        tfIntegracaoContabilTrabalhista = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        tfFGTS = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        tfIRRF = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        tfContribuicaoSindical = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        tfRAIS = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jButton4 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jLabel31 = new javax.swing.JLabel();
        tfRFB = new javax.swing.JTextField();
        jLabel32 = new javax.swing.JLabel();
        tfSEFAZ = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();
        tfPrefeitura = new javax.swing.JTextField();
        jLabel34 = new javax.swing.JLabel();
        tfINSS = new javax.swing.JTextField();
        jLabel35 = new javax.swing.JLabel();
        tfCND_FGTS = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        tfGIA_GIN = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        tfDIRF = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        tfDCTF = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        tfDACON = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        tfSEF = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        tfDS = new javax.swing.JTextField();
        jLabel36 = new javax.swing.JLabel();
        tfSPED_PIS = new javax.swing.JTextField();
        jLabel37 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        tfSPED_FISCAL = new javax.swing.JTextField();
        tfDIPJ = new javax.swing.JTextField();
        jLabel39 = new javax.swing.JLabel();
        tfDASN = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        MCadastro = new javax.swing.JMenu();
        IMRegras = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();

        jMenuItem1.setText("jMenuItem1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Controle de Movimentos");

        cbEmpresas.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""}));
        cbEmpresas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbEmpresasActionPerformed(evt);
            }
        });

        jLabel13.setText("Mês:");

        cbMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"-" , "JANEIRO", "FEVEREIRO", "MARÇO", "ABRIL", "MAIO", "JUNHO", "JULHO", "AGOSTO", "SETEMBRO", "OUTUBRO", "NOVEMBRO", "DEZEMBRO"}));
        cbMes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbMesActionPerformed(evt);
            }
        });

        jLabel14.setText("Ano:");

        cbAno.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"-","2011", "2012", "2013", "2014", "2015" }));
        cbAno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbAnoActionPerformed(evt);
            }
        });

        jLabel40.setText("Nome da Empresa:");

        jLabel41.setText("Código:");

        jLabel42.setText("Número do Contrato:");

        jLabel43.setText("PIN:");

        jLabel44.setText("PUK:");

        jButton6.setText("Analisar Pendencias");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jLabel15.setText("Escrituração");

        tfEscrituracao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfEscrituracaoActionPerformed(evt);
            }
        });

        jLabel16.setText("Integração contábil");

        tfIntegracaoContabil.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfIntegracaoContabilActionPerformed(evt);
            }
        });

        jLabel17.setText("DARF/IRRF");

        tfDarfIrrf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDarfIrrfActionPerformed(evt);
            }
        });

        jLabel18.setText("DAE - PARCELADO");

        tfDaeParcelado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDaeParceladoActionPerformed(evt);
            }
        });

        jLabel21.setText("ISS");

        jLabel22.setText("IPI");

        tfISS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfISSActionPerformed(evt);
            }
        });

        tfIPI.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfIPIActionPerformed(evt);
            }
        });

        jLabel23.setText("PIS");

        jLabel24.setText("COFINS");

        jLabel25.setText("ICMS Normal");

        jLabel26.setText("ICMS Antecipado");

        jLabel27.setText("CSLL");

        jLabel28.setText("IRPJ");

        tjPIS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tjPISActionPerformed(evt);
            }
        });

        tjCofins.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tjCofinsActionPerformed(evt);
            }
        });

        tjICMSNormal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tjICMSNormalActionPerformed(evt);
            }
        });

        tjICMSAntecipado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tjICMSAntecipadoActionPerformed(evt);
            }
        });

        tjIRPJ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tjIRPJActionPerformed(evt);
            }
        });

        tjCSLL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tjCSLLActionPerformed(evt);
            }
        });

        jLabel29.setText("Simples Nacional");

        tjSimplesNacional.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tjSimplesNacionalActionPerformed(evt);
            }
        });

        jButton1.setText("Registro de Eventos");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tfEscrituracao, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel16)
                                    .addComponent(jLabel15)
                                    .addComponent(jLabel17)
                                    .addComponent(tfIntegracaoContabil, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tfDarfIrrf, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel18)
                                    .addComponent(jLabel21)
                                    .addComponent(jLabel22)
                                    .addComponent(tfDaeParcelado, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tfISS, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tfIPI, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tjIRPJ, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tjPIS, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tjCofins, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tjICMSNormal, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tjICMSAntecipado, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel28)
                                    .addComponent(tjCSLL, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel27)
                                    .addComponent(jLabel26)
                                    .addComponent(jLabel25)
                                    .addComponent(jLabel24)))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(111, 111, 111)
                                .addComponent(jLabel23)))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel29)
                            .addComponent(tjSimplesNacional, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 515, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton1)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jLabel23)
                    .addComponent(jLabel29))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfEscrituracao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tjPIS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tjSimplesNacional, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(jLabel24))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfIntegracaoContabil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tjCofins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel25))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfDarfIrrf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tjICMSNormal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jLabel26))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfDaeParcelado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tjICMSAntecipado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(jLabel27))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfISS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tjCSLL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(jLabel28))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfIPI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tjIRPJ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Fiscal", jPanel1);

        jLabel19.setText("Contabilizado até:");

        tfContabilizadoAte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfContabilizadoAteActionPerformed(evt);
            }
        });

        jLabel20.setText("Data da última movimentação:");

        tfDataDaUltimaMovimentacao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDataDaUltimaMovimentacaoActionPerformed(evt);
            }
        });

        jButton2.setText("Registro de Eventos");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel19)
                            .addComponent(jLabel20)
                            .addComponent(tfDataDaUltimaMovimentacao, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfContabilizadoAte, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 663, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton2)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel19)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tfContabilizadoAte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel20)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tfDataDaUltimaMovimentacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 245, Short.MAX_VALUE)
                .addComponent(jButton2)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Contabilidade", jPanel2);

        tfGPS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfGPSActionPerformed(evt);
            }
        });

        jLabel7.setText("GPS:");

        tfFolhaPagamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfFolhaPagamentoActionPerformed(evt);
            }
        });

        jLabel8.setText("Folha de Pagamento:");

        tfIntegracaoContabilTrabalhista.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfIntegracaoContabilTrabalhistaActionPerformed(evt);
            }
        });

        jLabel9.setText("Integração Contábil:");

        tfFGTS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfFGTSActionPerformed(evt);
            }
        });

        jLabel10.setText("FGTS:");

        tfIRRF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfIRRFActionPerformed(evt);
            }
        });

        jLabel11.setText("IRRF");

        jLabel12.setText("Contribuição Sindical");

        tfContribuicaoSindical.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfContribuicaoSindicalActionPerformed(evt);
            }
        });

        jLabel30.setText("RAIS");

        tfRAIS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfRAISActionPerformed(evt);
            }
        });

        jButton3.setText("Registro de Eventos");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfRAIS, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel30)
                            .addComponent(tfGPS, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7)
                            .addComponent(tfFolhaPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8)
                            .addComponent(tfIntegracaoContabilTrabalhista, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9)
                            .addComponent(jLabel12)
                            .addComponent(tfFGTS, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10)
                            .addComponent(tfIRRF, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)
                            .addComponent(tfContribuicaoSindical, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 685, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton3)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel12)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfContribuicaoSindical, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfIRRF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfFGTS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfIntegracaoContabilTrabalhista, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfFolhaPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfGPS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel30)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfRAIS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
                .addComponent(jButton3)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Trabalhista", jPanel3);

        jButton4.setText("Registro de Eventos");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(687, Short.MAX_VALUE)
                .addComponent(jButton4)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(357, Short.MAX_VALUE)
                .addComponent(jButton4)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Impostos", jPanel4);

        jLabel31.setText("RFB");

        tfRFB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfRFBActionPerformed(evt);
            }
        });

        jLabel32.setText("SEFAZ");

        tfSEFAZ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfSEFAZActionPerformed(evt);
            }
        });

        jLabel33.setText("Prefeitura Municipal");

        tfPrefeitura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfPrefeituraActionPerformed(evt);
            }
        });

        jLabel34.setText("INSS");

        tfINSS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfINSSActionPerformed(evt);
            }
        });

        jLabel35.setText("FGTS");

        tfCND_FGTS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfCND_FGTSActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel31)
                    .addComponent(tfRFB, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel32)
                    .addComponent(tfSEFAZ, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel33)
                    .addComponent(tfPrefeitura, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel34)
                    .addComponent(tfINSS, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel35)
                    .addComponent(tfCND_FGTS, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(724, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel31)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfRFB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel32)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfSEFAZ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel33)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfPrefeitura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel34)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfINSS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(9, 9, 9)
                .addComponent(jLabel35)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tfCND_FGTS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(133, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("CND", jPanel5);

        jLabel1.setText("GIA/GIN:");

        tfGIA_GIN.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        tfGIA_GIN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfGIA_GINActionPerformed(evt);
            }
        });

        jLabel2.setText("DIRF:");

        tfDIRF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDIRFActionPerformed(evt);
            }
        });

        jLabel3.setText("DCTF:");

        tfDCTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDCTFActionPerformed(evt);
            }
        });

        jLabel4.setText("DACON");

        tfDACON.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDACONActionPerformed(evt);
            }
        });

        jLabel5.setText("SEF");

        tfSEF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfSEFActionPerformed(evt);
            }
        });

        jLabel6.setText("DS:");

        tfDS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDSActionPerformed(evt);
            }
        });

        jLabel36.setText("SPED PIS/CONFINS");

        tfSPED_PIS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfSPED_PISActionPerformed(evt);
            }
        });

        jLabel37.setText("SPED FISCAL");

        jLabel38.setText("DIPJ");

        tfSPED_FISCAL.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfSPED_FISCALActionPerformed(evt);
            }
        });

        tfDIPJ.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDIPJActionPerformed(evt);
            }
        });

        jLabel39.setText("DASN");

        tfDASN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfDASNActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(tfDS, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(tfSEF, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3)
                                    .addComponent(tfGIA_GIN)
                                    .addComponent(tfDCTF)
                                    .addComponent(tfDIRF)
                                    .addComponent(jLabel4)
                                    .addComponent(tfDACON, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(jLabel5)))
                        .addComponent(jLabel6)))
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(15, 15, 15)
                        .addComponent(jLabel36))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel39)
                            .addComponent(jLabel38)
                            .addComponent(jLabel37)
                            .addComponent(tfSPED_PIS)
                            .addComponent(tfSPED_FISCAL)
                            .addComponent(tfDIPJ)
                            .addComponent(tfDASN))))
                .addContainerGap(612, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel36))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfGIA_GIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfSPED_PIS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel37))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfDIRF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfSPED_FISCAL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel38))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfDCTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfDIPJ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel39))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfDACON, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfDASN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tfSEF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(tfDS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(65, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Declarações", jPanel6);

        MCadastro.setText("Cadastros");

        IMRegras.setText("Metas");
        IMRegras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                IMRegrasActionPerformed(evt);
            }
        });
        MCadastro.add(IMRegras);

        jMenuItem2.setText("Empresa");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        MCadastro.add(jMenuItem2);

        jMenuBar1.add(MCadastro);

        jMenu2.setText("Relatórios");
        jMenuBar1.add(jMenu2);

        jMenu3.setText("Ajuda");
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel40)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, 441, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(tfCodigo, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel41, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(17, 17, 17)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel42, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(tfNumContrato, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel43)
                                    .addComponent(tfPin, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel44)
                                    .addComponent(tfPuk, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel13)
                                        .addGap(12, 12, 12))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(cbMes, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel14)
                                        .addGap(40, 40, 40))
                                    .addComponent(cbAno, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(cbEmpresas, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton6))
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbEmpresas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel40)
                    .addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(jLabel14)
                            .addComponent(jLabel41))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(12, 12, 12)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(cbMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cbAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(tfCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel42)
                            .addComponent(jLabel43))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfNumContrato, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfPin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfPuk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel44))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 91, Short.MAX_VALUE)
                .addComponent(jButton6)
                .addGap(33, 33, 33)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 416, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cbEmpresasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbEmpresasActionPerformed
        if (empresas != null) {
            carregarMovimentos();
            tfCodigo.setText(empresas.get(cbEmpresas.getSelectedIndex()).getCodigo());
            tfNumContrato.setText(empresas.get(cbEmpresas.getSelectedIndex()).getNum_contrato());
            tfPin.setText(empresas.get(cbEmpresas.getSelectedIndex()).getPin());
            tfPuk.setText(empresas.get(cbEmpresas.getSelectedIndex()).getPuk());
        }
    }//GEN-LAST:event_cbEmpresasActionPerformed

    private void cbMesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbMesActionPerformed
        if (empresas != null) {
            carregarMovimentos();
        }
    }//GEN-LAST:event_cbMesActionPerformed

    private void cbAnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbAnoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cbAnoActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        periodo.setId(cbMes.getSelectedIndex());
        if (ap != null) {
            ap.toFront();
            ap.setVisible(true);
        } else {
            ap = new AnalisePendencias(periodo);
            ap.setVisible(true);
        }

    }//GEN-LAST:event_jButton6ActionPerformed

    private void IMRegrasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IMRegrasActionPerformed
        Metas meta = new Metas(this, rootPaneCheckingEnabled);
        meta.setVisible(rootPaneCheckingEnabled);
    }//GEN-LAST:event_IMRegrasActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        CadastrarEmpresa ce = new CadastrarEmpresa(this, rootPaneCheckingEnabled);
        ce.setVisible(true);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void tfEscrituracaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfEscrituracaoActionPerformed
        definirAtributos();
        imposto.setId(1);
        movimento.setImposto(imposto);
        movimento.setValor(tfEscrituracao.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfEscrituracaoActionPerformed

    private void tfIntegracaoContabilActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfIntegracaoContabilActionPerformed
        definirAtributos();
        imposto.setId(2);
        movimento.setImposto(imposto);
        movimento.setValor(tfIntegracaoContabil.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfIntegracaoContabilActionPerformed

    private void tfDarfIrrfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDarfIrrfActionPerformed
        definirAtributos();
        imposto.setId(3);
        movimento.setImposto(imposto);
        movimento.setValor(tfDarfIrrf.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDarfIrrfActionPerformed

    private void tfDaeParceladoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDaeParceladoActionPerformed
        definirAtributos();
        imposto.setId(4);
        movimento.setImposto(imposto);
        movimento.setValor(tfDaeParcelado.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDaeParceladoActionPerformed

    private void tfISSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfISSActionPerformed
        definirAtributos();
        imposto.setId(5);
        movimento.setImposto(imposto);
        movimento.setValor(tfISS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfISSActionPerformed

    private void tfIPIActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfIPIActionPerformed
        definirAtributos();
        imposto.setId(6);
        movimento.setImposto(imposto);
        movimento.setValor(tfIPI.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfIPIActionPerformed

    private void tjPISActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tjPISActionPerformed
        definirAtributos();
        imposto.setId(7);
        movimento.setImposto(imposto);
        movimento.setValor(tjPIS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tjPISActionPerformed

    private void tjCofinsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tjCofinsActionPerformed
        definirAtributos();
        imposto.setId(8);
        movimento.setImposto(imposto);
        movimento.setValor(tjCofins.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tjCofinsActionPerformed

    private void tjICMSNormalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tjICMSNormalActionPerformed
        definirAtributos();
        imposto.setId(9);
        movimento.setImposto(imposto);
        movimento.setValor(tjICMSNormal.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tjICMSNormalActionPerformed

    private void tjICMSAntecipadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tjICMSAntecipadoActionPerformed
        definirAtributos();
        imposto.setId(10);
        movimento.setImposto(imposto);
        movimento.setValor(tjICMSAntecipado.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tjICMSAntecipadoActionPerformed

    private void tjIRPJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tjIRPJActionPerformed
        definirAtributos();
        imposto.setId(12);
        movimento.setImposto(imposto);
        movimento.setValor(tjIRPJ.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tjIRPJActionPerformed

    private void tjCSLLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tjCSLLActionPerformed
        definirAtributos();
        imposto.setId(11);
        movimento.setImposto(imposto);
        movimento.setValor(tjCSLL.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tjCSLLActionPerformed

    private void tjSimplesNacionalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tjSimplesNacionalActionPerformed
        definirAtributos();
        imposto.setId(13);
        movimento.setImposto(imposto);
        movimento.setValor(tjSimplesNacional.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tjSimplesNacionalActionPerformed

    private void tfContabilizadoAteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfContabilizadoAteActionPerformed
        definirAtributos();
        imposto.setId(14);
        movimento.setImposto(imposto);
        movimento.setValor(tfContabilizadoAte.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfContabilizadoAteActionPerformed

    private void tfDataDaUltimaMovimentacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDataDaUltimaMovimentacaoActionPerformed
        definirAtributos();
        imposto.setId(15);
        movimento.setImposto(imposto);
        movimento.setValor(tfDataDaUltimaMovimentacao.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDataDaUltimaMovimentacaoActionPerformed

    private void tfGPSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfGPSActionPerformed
        definirAtributos();
        imposto.setId(21);
        movimento.setImposto(imposto);
        movimento.setValor(tfGPS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfGPSActionPerformed

    private void tfFolhaPagamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfFolhaPagamentoActionPerformed
        definirAtributos();
        imposto.setId(20);
        movimento.setImposto(imposto);
        movimento.setValor(tfFolhaPagamento.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfFolhaPagamentoActionPerformed

    private void tfIntegracaoContabilTrabalhistaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfIntegracaoContabilTrabalhistaActionPerformed
        definirAtributos();
        imposto.setId(19);
        movimento.setImposto(imposto);
        movimento.setValor(tfIntegracaoContabil.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfIntegracaoContabilTrabalhistaActionPerformed

    private void tfFGTSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfFGTSActionPerformed
        definirAtributos();
        imposto.setId(18);
        movimento.setImposto(imposto);
        movimento.setValor(tfFGTS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfFGTSActionPerformed

    private void tfIRRFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfIRRFActionPerformed
        definirAtributos();
        imposto.setId(17);
        movimento.setImposto(imposto);
        movimento.setValor(tfIRRF.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfIRRFActionPerformed

    private void tfContribuicaoSindicalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfContribuicaoSindicalActionPerformed
        definirAtributos();
        imposto.setId(16);
        movimento.setImposto(imposto);
        movimento.setValor(tfContribuicaoSindical.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfContribuicaoSindicalActionPerformed

    private void tfRAISActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfRAISActionPerformed
        definirAtributos();
        imposto.setId(22);
        movimento.setImposto(imposto);
        movimento.setValor(tfRAIS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfRAISActionPerformed

    private void tfRFBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfRFBActionPerformed
        definirAtributos();
        imposto.setId(23);
        movimento.setImposto(imposto);
        movimento.setValor(tfRFB.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfRFBActionPerformed

    private void tfSEFAZActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfSEFAZActionPerformed
        definirAtributos();
        imposto.setId(24);
        movimento.setImposto(imposto);
        movimento.setValor(tfSEFAZ.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfSEFAZActionPerformed

    private void tfPrefeituraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfPrefeituraActionPerformed
        definirAtributos();
        imposto.setId(25);
        movimento.setImposto(imposto);
        movimento.setValor(tfPrefeitura.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfPrefeituraActionPerformed

    private void tfINSSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfINSSActionPerformed
        definirAtributos();
        imposto.setId(26);
        movimento.setImposto(imposto);
        movimento.setValor(tfINSS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfINSSActionPerformed

    private void tfCND_FGTSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfCND_FGTSActionPerformed
        definirAtributos();
        imposto.setId(27);
        movimento.setImposto(imposto);
        movimento.setValor(tfCND_FGTS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfCND_FGTSActionPerformed

    private void tfGIA_GINActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfGIA_GINActionPerformed
        definirAtributos();
        imposto.setId(28);
        movimento.setImposto(imposto);
        movimento.setValor(tfGIA_GIN.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfGIA_GINActionPerformed

    private void tfDIRFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDIRFActionPerformed
        definirAtributos();
        imposto.setId(29);
        movimento.setImposto(imposto);
        movimento.setValor(tfDIRF.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDIRFActionPerformed

    private void tfDCTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDCTFActionPerformed
        definirAtributos();
        imposto.setId(37);
        movimento.setImposto(imposto);
        movimento.setValor(tfDCTF.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDCTFActionPerformed

    private void tfDACONActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDACONActionPerformed
        definirAtributos();
        imposto.setId(30);
        movimento.setImposto(imposto);
        movimento.setValor(tfDACON.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDACONActionPerformed

    private void tfSEFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfSEFActionPerformed
        definirAtributos();
        imposto.setId(31);
        movimento.setImposto(imposto);
        movimento.setValor(tfSEF.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfSEFActionPerformed

    private void tfDSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDSActionPerformed
        definirAtributos();
        imposto.setId(32);
        movimento.setImposto(imposto);
        movimento.setValor(tfDS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDSActionPerformed

    private void tfSPED_PISActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfSPED_PISActionPerformed
        definirAtributos();
        imposto.setId(33);
        movimento.setImposto(imposto);
        movimento.setValor(tfSPED_PIS.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfSPED_PISActionPerformed

    private void tfSPED_FISCALActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfSPED_FISCALActionPerformed
        definirAtributos();
        imposto.setId(34);
        movimento.setImposto(imposto);
        movimento.setValor(tfSPED_FISCAL.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfSPED_FISCALActionPerformed

    private void tfDIPJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDIPJActionPerformed
        definirAtributos();
        imposto.setId(35);
        movimento.setImposto(imposto);
        movimento.setValor(tfDIPJ.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDIPJActionPerformed

    private void tfDASNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfDASNActionPerformed
        definirAtributos();
        imposto.setId(36);
        movimento.setImposto(imposto);
        movimento.setValor(tfDASN.getText());
        if (Facade.getInstancia().existeMovimento(movimento)) {
            Facade.getInstancia().editarMovimento(movimento);
        } else {
            Facade.getInstancia().salvarMovimento(movimento);
        }
    }//GEN-LAST:event_tfDASNActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        empresa = empresas.get(cbEmpresas.getSelectedIndex());
        RegistroAtividades ra = new RegistroAtividades(this, rootPaneCheckingEnabled, empresa,usuario);
        ra.setVisible(rootPaneCheckingEnabled);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        empresa = empresas.get(cbEmpresas.getSelectedIndex());
        RegistroAtividades ra = new RegistroAtividades(this, rootPaneCheckingEnabled,empresa,usuario);
        ra.setVisible(rootPaneCheckingEnabled);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        empresa = empresas.get(cbEmpresas.getSelectedIndex());
        RegistroAtividades ra = new RegistroAtividades(this, rootPaneCheckingEnabled,empresa,usuario);
        ra.setVisible(rootPaneCheckingEnabled);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        empresa = empresas.get(cbEmpresas.getSelectedIndex());
        RegistroAtividades ra = new RegistroAtividades(this, rootPaneCheckingEnabled,empresa,usuario);
        ra.setVisible(rootPaneCheckingEnabled);
    }//GEN-LAST:event_jButton4ActionPerformed

    public final void carregarComboEmpresas() {
        //CARREGAR COMBO EMPRESA
        cbEmpresas.removeAllItems();
        empresas = EC.listarEmpresas();
        for (int i = 0; i < empresas.size(); i++) {
            cbEmpresas.addItem(empresas.get(i).getNome());
        }
    }

    private void definirAtributos() {
        //USUARIO
        movimento.setUsuario(usuario);
        //EMPRESA
        empresa = empresas.get(cbEmpresas.getSelectedIndex());
        //PERÍODO
        periodo.setId(cbMes.getSelectedIndex());
        //SETANDO OS ATRIBUTOS
        movimento.setPeriodo(periodo);
        movimento.setEmpresa(empresa);
    }

    private void carregarData() {
        GregorianCalendar agora = new GregorianCalendar();
        int mes = agora.get(Calendar.MONTH);
        int ano = agora.get(Calendar.YEAR);
        cbMes.setSelectedIndex(mes + 1);
        for (int i = 0; i < cbAno.getItemCount(); i++) {
            if (cbAno.getItemAt(i).equals(String.valueOf(ano))) {
                cbAno.setSelectedIndex(i);
            }

        }
        cbAno.setSelectedItem(ano);

    }

    private void carregarMovimentos() {
        limparCampos();
        empresa.setId(empresas.get(cbEmpresas.getSelectedIndex()).getId());
        movimento.setEmpresa(empresa);
        periodo.setMes(String.valueOf(cbMes.getSelectedIndex()));
        periodo.setAno(String.valueOf(cbAno.getSelectedItem()));
        periodo.setId(cbMes.getSelectedIndex());
        movimento.setPeriodo(periodo);
        List<Movimento> movimentos = Facade.getInstancia().carregaMovimento(movimento);
        for (Movimento movimentos1 : movimentos) {
            if (movimentos1.getImposto().getId() == 1) {
                tfEscrituracao.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 2) {
                tfIntegracaoContabil.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 3) {
                tfDarfIrrf.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 4) {
                tfDaeParcelado.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 5) {
                tfISS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 6) {
                tfIPI.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 7) {
                tjPIS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 8) {
                tjCofins.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 9) {
                tjICMSNormal.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 10) {
                tjICMSAntecipado.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 11) {
                tjCSLL.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 12) {
                tjIRPJ.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 13) {
                tjSimplesNacional.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 14) {
                tfContabilizadoAte.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 15) {
                tfDataDaUltimaMovimentacao.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 16) {
                tfContribuicaoSindical.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 17) {
                tfIRRF.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 18) {
                tfFGTS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 19) {
                tfIntegracaoContabil.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 20) {
                tfFolhaPagamento.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 21) {
                tfGPS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 22) {
                tfRAIS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 23) {
                tfRFB.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 24) {
                tfSEFAZ.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 25) {
                tfPrefeitura.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 26) {
                tfINSS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 27) {
                tfCND_FGTS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 28) {
                tfGIA_GIN.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 29) {
                tfDIRF.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 30) {
                tfDACON.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 31) {
                tfSEF.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 32) {
                tfDS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 33) {
                tfSPED_PIS.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 34) {
                tfSPED_FISCAL.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 35) {
                tfDIPJ.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 36) {
                tfDASN.setText(movimentos1.getValor());
            } else if (movimentos1.getImposto().getId() == 37) {
                tfDCTF.setText(movimentos1.getValor());
            }
        }
    }

    private void limparCampos() {
        tfEscrituracao.setText(null);
        tfIntegracaoContabil.setText(null);
        tfDarfIrrf.setText(null);
        tfDaeParcelado.setText(null);
        tfISS.setText(null);
        tfIPI.setText(null);
        tjPIS.setText(null);
        tjICMSAntecipado.setText(null);
        tjICMSNormal.setText(null);
        tjCofins.setText(null);
        tjCSLL.setText(null);
        tjIRPJ.setText(null);
        tjSimplesNacional.setText(null);
        tfDataDaUltimaMovimentacao.setText(null);
        tfContribuicaoSindical.setText(null);
        tfIRRF.setText(null);
        tfFGTS.setText(null);
        tfIntegracaoContabil.setText(null);
        tfFolhaPagamento.setText(null);
        tfGPS.setText(null);
        tfRAIS.setText(null);
        tfRFB.setText(null);
        tfSEFAZ.setText(null);
        tfPrefeitura.setText(null);
        tfINSS.setText(null);
        tfCND_FGTS.setText(null);
        tfGIA_GIN.setText(null);
        tfDIRF.setText(null);
        tfDACON.setText(null);
        tfSEF.setText(null);
        tfDS.setText(null);
        tfSPED_FISCAL.setText(null);
        tfSPED_PIS.setText(null);
        tfDASN.setText(null);
        tfDCTF.setText(null);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem IMRegras;
    private javax.swing.JMenu MCadastro;
    private javax.swing.JComboBox cbAno;
    private javax.swing.JComboBox cbEmpresas;
    private javax.swing.JComboBox cbMes;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTextField38;
    private javax.swing.JTextField tfCND_FGTS;
    private javax.swing.JTextField tfCodigo;
    private javax.swing.JTextField tfContabilizadoAte;
    private javax.swing.JTextField tfContribuicaoSindical;
    private javax.swing.JTextField tfDACON;
    private javax.swing.JTextField tfDASN;
    private javax.swing.JTextField tfDCTF;
    private javax.swing.JTextField tfDIPJ;
    private javax.swing.JTextField tfDIRF;
    private javax.swing.JTextField tfDS;
    private javax.swing.JTextField tfDaeParcelado;
    private javax.swing.JTextField tfDarfIrrf;
    private javax.swing.JTextField tfDataDaUltimaMovimentacao;
    private javax.swing.JTextField tfEscrituracao;
    private javax.swing.JTextField tfFGTS;
    private javax.swing.JTextField tfFolhaPagamento;
    private javax.swing.JTextField tfGIA_GIN;
    private javax.swing.JTextField tfGPS;
    private javax.swing.JTextField tfINSS;
    private javax.swing.JTextField tfIPI;
    private javax.swing.JTextField tfIRRF;
    private javax.swing.JTextField tfISS;
    private javax.swing.JTextField tfIntegracaoContabil;
    private javax.swing.JTextField tfIntegracaoContabilTrabalhista;
    private javax.swing.JTextField tfNumContrato;
    private javax.swing.JTextField tfPin;
    private javax.swing.JTextField tfPrefeitura;
    private javax.swing.JTextField tfPuk;
    private javax.swing.JTextField tfRAIS;
    private javax.swing.JTextField tfRFB;
    private javax.swing.JTextField tfSEF;
    private javax.swing.JTextField tfSEFAZ;
    private javax.swing.JTextField tfSPED_FISCAL;
    private javax.swing.JTextField tfSPED_PIS;
    private javax.swing.JTextField tjCSLL;
    private javax.swing.JTextField tjCofins;
    private javax.swing.JTextField tjICMSAntecipado;
    private javax.swing.JTextField tjICMSNormal;
    private javax.swing.JTextField tjIRPJ;
    private javax.swing.JTextField tjPIS;
    private javax.swing.JTextField tjSimplesNacional;
    // End of variables declaration//GEN-END:variables
}
